{template "content","header"}

{pc:block pos="index_banner"}{/pc}

<script type="text/javascript" charset="utf-8">
    var slider = mui("#slider");

    slider.slider({
        interval: 5000
    });
</script>

{pc:block pos="index_tip"}{/pc}

{pc:block pos="index_feedback_bg"}{/pc}

<style>
    .mui-input-row .mui-btn~input, .mui-input-row .mui-btn~select, .mui-input-row .mui-btn~textarea{
        background-color: #ffffff;
        padding-left:10px;
    }
</style>
<div id="feedback" style="padding: 10px;">
    <h5>您的姓名[已加密，请放心填写]*：</h5>
    <div class="mui-input-row">
        <input type="text" id="name" class="mui-input-clear" placeholder="请输入姓名">
    </div>
    <h5>您的电话[已加密，请放心填写] *：</h5>
    <div class="mui-input-row">
        <input type="text" id="mobile" class="mui-input-clear" placeholder="请输入手机">
    </div>

    <div class="mui-input-row">
        <button type="button" class="mui-btn mui-btn-primary" id="sendsms">发送</button>
        <input type="text" id="code" class="mui-input-clear" placeholder="请输入收到的验证码">
    </div>

    <h5 class="mui-content-padded">您要咨询的法律问题(单选)*</h5>
    <div class="mui-input-group">
        <div class="mui-input-row mui-radio mui-left">
            <label>房产纠纷</label>
            <input name="question" type="radio" value="房产纠纷">
        </div>
        <div class="mui-input-row mui-radio mui-left">
            <label>婚姻家事</label>
            <input name="question" type="radio" value="婚姻家事">
        </div>
        <div class="mui-input-row mui-radio mui-left">
            <label>经济纠纷</label>
            <input name="question" type="radio" value="经济纠纷">
        </div>
        <div class="mui-input-row mui-radio mui-left">
            <label>刑事辩护</label>
            <input name="question" type="radio" value="刑事辩护">
        </div>
        <div class="mui-input-row mui-radio mui-left">
            <label>债权债务</label>
            <input name="question" type="radio" value="债权债务">
        </div>
        <div class="mui-input-row mui-radio mui-left">
            <label>合同纠纷</label>
            <input name="question" type="radio" value="合同纠纷">
        </div>
        <div class="mui-input-row mui-radio mui-left">
            <label>其他纠纷</label>
            <input name="question" type="radio" value="其他纠纷">
        </div>
    </div>


    <h5 class="mui-content-padded">涉案金额(低于5万不受理)(单选)*</h5>
    <div class="mui-input-group">
        <div class="mui-input-row mui-radio mui-left">
            <label>1万一10万</label>
            <input name="money" type="radio" value="1万一10万">
        </div>
        <div class="mui-input-row mui-radio mui-left">
            <label>10万一100万</label>
            <input name="money" type="radio" value="10万一100万">
        </div>
        <div class="mui-input-row mui-radio mui-left">
            <label>100万以上</label>
            <input name="money" type="radio" value="100万以上">
        </div>
    </div>


    <div class="mui-input-row mui-checkbox mui-left">
        <label><h5>阅读并同意 <a >《授权书》</a></h5></label>
        <input name="agree" value="1" type="checkbox" checked >
    </div>

    <div class="mui-content-padded">
    <button type="button" class="submit mui-btn mui-btn-danger mui-btn-block">立即预约专业律师咨论</button>
    </div>
</div>
<div id="winAgree" style="position: fixed;width: 100%;height: 100%;z-index: 9990;display: none;left: 0;top: 0;background-color: #fff;">
    <header class="mui-bar mui-bar-nav">
        <h1 class="mui-title">授权书</h1>
        <a id="closeAgree" class="mui-icon mui-icon-closeempty mui-pull-right" style="color: #999;"></a>
    </header>
    <div class="mui-content">
    <div class="mui-card">
        <div class="mui-card-content">
            <div class="mui-card-content-inner">
                {pc:block pos="index_agree"}{/pc}
            </div>
        </div>
    </div>
    </div>
</div>
<div class="mui-page-content">
    {pc:block pos="index_ad"}{/pc}
</div>


<button type="button" class="submit mui-btn mui-btn-danger mui-btn-block">立即预约专业律师咨论</button>
<script type="text/javascript" charset="utf-8">
    $(".submit").on('click', function() {
        var sms_code = $('#code').val();
        if(sms_code=='') {
            alert('请输入验证码');
            $('#code').focus();
            return false;
        }
        var server = "{APP_PATH}index.php?m=guestbook&c=index&a=register&siteid={$siteid}"; //获取升级描述文件服务器地址
        mui.getJSON(server, {
            "name": get('name').value,
            "shouji": get('mobile').value,
            "question": $("input[name='question']:checked").val(),
            "money": $("input[name='money']:checked").val(),
            'code': sms_code
        }, function(data) {
            if (data.code == 1) {
                alert('预约已提交,请稍后接听律师电话!');
                window.location.reload();
            } else {
                alert(data.msg)
            }
        });

    });

    mui('.mui-checkbox').on('change', 'input', function() {
        this.checked = true;
        $('#winAgree').show();
    });
    $("#closeAgree").on('click', function() {
        $('#winAgree').hide();
    })
    var sec=60;
    $("#sendsms").on('click', function() {

        var mobile = $("#mobile").val();
        var partten = /^1[3-9]\d{9}$/;
        if(!partten.test(mobile)){
            alert("请输入正确的手机号码");
            $('#mobile').focus();
            return false;
        }
        $.get("/api.php?op=sms_aliyun",{ mobile: mobile,random:Math.random() }, function(data){
            if(data=="0") {
                $("#mobile").attr('readonly',true);
                $("#sendsms").attr('disabled',true);
                sec=60;
                countDown();
                // alert("发送成功");
            } else if(data=="-1") {
                alert("已超过发送次数限制");
            } else if(data=="-3") {
                alert("请不要频繁发送");
            } else {
                alert("发送失败");
            }
        });
    })
    function countDown()
    {

        setTimeout(function (){
            sec--;
            if(sec<0)
            {
                $("#sendsms").attr('disabled',false);
                $("#sendsms").html('发送')
                return false;
            }
            $("#sendsms").html(sec+'秒')
            countDown();
        },1000)
    }
</script>

{template "content","footer"}